<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">意见反馈</ui:define>
    <ui:define name="content">
        <style type="text/css">
            .description {
                white-space: normal;
            }
        </style>

        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="feedbackListDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{feedbackListBean.isNormal()}"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{feedbackListBean.onReset}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{feedbackListBean.isNormal()}"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         rendered="#{feedbackListBean.isBatch()}">
                            <p:dataExporter type="xls" target="feedbackListDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12">
                    <div class="ui-g-12 card">
                        <h1>查询条件</h1>

                        <div class="ui-g-1">
                            <p:outputLabel value="时间"/>
                        </div>
                        <div class="ui-g-3">
                            <p:calendar
                                    id="createStartTime" styleClass="autoWidthCalendar"
                                    value="#{feedbackListBean.$.createStartTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                            <span>—</span>
                            <p:calendar
                                    id="createEndTime" styleClass="autoWidthCalendar"
                                    value="#{feedbackListBean.$.createEndTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="产品"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectCheckboxMenu id="productIds" value="#{feedbackListBean.$.productIdList}"
                                                  updateLabel="true" multiple="true" filter="true"
                                                  filterMatchMode="contains">
                                <f:selectItems
                                        value="#{feedbackListBean.commProductIds}"
                                        var="product"
                                        itemLabel="#{product.name}(#{product.productId})" itemValue="#{product.productId}"/>
                            </p:selectCheckboxMenu>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="反馈类型"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu value="#{feedbackListBean.$.feedbackType}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{feedbackListBean.dictionaries[DictionaryCode.FEEDBACK_TYPE]}"
                                        var="dic"
                                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="是否已处理"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu value="#{feedbackListBean.$.isResolved}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                <f:selectItem itemLabel="未处理" itemValue="false"/>
                                <f:selectItem itemLabel="已处理" itemValue="true"/>
                            </p:selectOneMenu>
                        </div>
                    </div>
                    <div class="ui-g-12 card">
                        <p:dataTable id="feedbackListDataTable"
                                     style="width: 100%"
                                     var="feedback"
                                     value="#{feedbackListBean.lazyDataModel}"
                                     rows="#{constants:get('ROWS')}"
                                     lazy="true"
                                     paginator="true"
                                     paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                     rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                     emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                     reflow="true"
                                     selection="#{feedbackListBean.selectedRecords}"
                                     resizableColumns="true">

                            <p:column headerText="操作" style="width: 70px;text-align:center;"
                                      rendered="#{feedbackListBean.isNotBatch()}">
                                <p:splitButton icon="fa fa-eye">
                                    <p:menuitem value="处理"
                                                action="#{feedbackListBean.onResolve(feedback.id)}"
                                                process="@this" update="@form"
                                                rendered="#{!feedback.isResolved}"/>
                                    <p:menuitem value="删除"
                                                action="#{feedbackListBean.onDelete(feedback.id)}"
                                                process="@this" update="@form"/>
                                </p:splitButton>
                            </p:column>
                            <p:column headerText="时间">
                                <h:outputText value="#{feedback.createTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="产品">
                                <h:outputText value="#{feedbackListBean.translateProduct(feedback.productId)}"/>
                            </p:column>
                            <p:column headerText="入口id">
                                <h:outputText value="#{feedback.entranceId}"/>
                            </p:column>
                            <p:column headerText="登录手机号">
                                <h:outputText value="#{feedback.loginPhoneNo}"/>
                            </p:column>
                            <p:column headerText="预留联系方式">
                                <h:outputText value="#{feedback.reservedPhoneNo}"/>
                            </p:column>
                            <p:column headerText="反馈类型">
                                <h:outputText value="#{feedbackListBean.translate(DictionaryCode.FEEDBACK_TYPE, feedback.feedbackType)}"/>
                            </p:column>
                            <p:column headerText="描述">
                                <h:outputText value="#{feedback.description}" styleClass="description"/>
                            </p:column>
                            <p:column headerText="是否已处理">
                                <h:outputText value="#{feedbackListBean.translateResolved(feedback.isResolved)}"/>
                            </p:column>
                        </p:dataTable>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
